package com.example.config;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.PropertiesUtil;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.io.*;
import java.util.Properties;

/**
 * @Description : 读取配置文件
 * @Author : ZYX
 * @Date : 2023/12/18 20:20
 * @Version : 1.0
 **/
@Slf4j
public class TestConfig {

    public static String key1;
    public static String key2;
    public static String key3;
    public static String key4;

    static {
        String property = System.getProperty("user.dir");
        Properties properties = new Properties();
        try (
                BufferedInputStream in = new BufferedInputStream(new FileInputStream(property + "/config/configTest.properties"));
                InputStreamReader reader = new InputStreamReader(in);
                ){

            properties.load(reader);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        key1 = properties.getProperty("api.key1");
        key2 = properties.getProperty("api.key2");
        key3 = properties.getProperty("api.key3");
        key4 = properties.getProperty("api.key4");
    }

}
